// import React, { useEffect, useState } from "react";
// import store, { RootState } from "../../store";
// import { connect } from "react-redux";

// type PorpsType = ReturnType<typeof mapStateToProps> &
//   ReturnType<typeof mapDispatchToProps>;

// const Index: React.FC<PorpsType> = ({ count, addCount }) => {
//   return (
//     <div>
//       <h1>仓库链接</h1>
//       <hr />
//       <div>
//         count: {count}
//         <button onClick={() => addCount()}>+1</button>
//       </div>
//     </div>
//   );
// };

// const mapStateToProps = (state: RootState) => {
//   return {
//     count: state.count,
//   };
// };

// const mapDispatchToProps = (dispatch) => {
//   return {
//     addCount() {
//       dispatch({ type: "addCount" });
//     },
//   };
// };

// export default connect(mapStateToProps, mapDispatchToProps)(Index);

import React from "react";
import { useSelector, useDispatch } from "react-redux";
import { RootState } from "../../store";
import { addCountActionCreator } from '../../store/testt/reducerTest'
const Index: React.FC = () => {
  const count = useSelector((state: RootState) => state.test.count);
  const username = useSelector((state: RootState) => state.user.username);
  const dispatch = useDispatch();

  return (
    <div>
      <h1>仓库链接</h1>
      <hr />
      <div>
        count: {count}
        <button onClick={() => dispatch(addCountActionCreator(1))}>+1</button>
        <button onClick={() => dispatch(addCountActionCreator(2))}>+2</button>
        <button onClick={() => dispatch(addCountActionCreator(3))}>+3</button>
      </div>
      <h1>{username}</h1>
    </div>
  );
};

export default Index;
